<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Masking</title>
  <!-- 有歧义的蒙版 -->
  <style>
    *{
      padding: 0;
      margin: 0;
      list-style: none;
    }
    #root{
      position: relative;
    }
    span{
      display: inline-block;
      width: 100px;
    }
    .realityBlock{
      position: absolute;
    }
    .maskBlock{
      /* position: absolute; */
    }
  </style>
</head>
<body>
  <div id="root">
    <div class="realityBlock">
      <span>UserName:</span><input type="text" >
      </br>
      <span>PassWord:</span><input class="password" type="password" >
    </div>
    <div class="maskBlock">
      <span>UserName:</span><input type="text" >
      </br>
      <span>PassWord: </span><input type="password" >
    </div>
  </div>
</body>
<script>
  const passwordObj = document.querySelectorAll('input.password')
  passwordObj[0].addEventListener('input', (e) => {
    console.log(e.target.value)
  })
</script>
</html>